package com.kwan.x_im.data.http;

import com.kwan.xframe.mvvm.data.source.http.HttpResult;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.rxjava3.core.Flowable;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;


/**
 * @ Path是网址中的参数,例如:trades/{userId}
 * @ Query是问号后面的参数,例如:trades/{userId}?token={token}
 * @ QueryMap 相当于多个@Query
 * @ Field用于Post请求,提交单个数据,然后要加@FormUrlEncoded
 * @ Body相当于多个@Field,以对象的方式提交
 * @ Streaming:用于下载大文件
 * @ Header,@Headers、加请求头
 */


public interface ApiService {


	enum FUNC {

		/**
		 * http://8.217.117.105:13851/api/check/token?idToken=""
		 */

		CheckToken,

		/**
		 * http://8.217.117.105:13851/api/token/sign?token=""
		 */

		RefreshToken,

		Banner,

		Library,

		SellWell,

		AddLibrary,


		/**
		 * 获取用户金币数
		 */

		GetUserSpecies,

		/**
		 * 验证订单
		 * <a href="http://8.217.117.105:13850/order/item/verify/order?jsonData=">...</a>""
		 */
		VerifyOrder,

		/**
		 * 购买章节
		 * <a href="http://8.217.117.105:13850/api/purchaseChapter">...</a>
		 */
		PurchaseChapter,

		/**
		 * 查询已购买章节
		 * <a href="http://8.217.117.105:13850/api/getPurchaseChapterNum">...</a>
		 */

		GetPurchaseChapter,

		/**
		 * 生成订单
		 * <a href="http://8.217.117.105:13850/order/item/generate/orderSn">...</a>
		 */
		OrderSn;

		public HashMap<String, Object> extra = new HashMap<>();
	}

	/**
	 * 注意 腾讯云函数 请求参数 要使用 QueryMap 不能是 FieldMap
	 */

	@POST("/api/check/token")
	Flowable<HttpResult<Object>> checkToken(@QueryMap Map<String, Object> map);

	@POST("/api/token/sign")
	Flowable<HttpResult<Object>> refreshToken();

	@POST("/order/item/generate/orderSn")
	Flowable<HttpResult<Object>> orderSn(@Body Map<String, Object> map);

	@POST("/order/item/verify/order")
	Flowable<HttpResult<Object>> verifyOrder(@QueryMap Map<String, Object> map);

	@POST("/api/purchaseChapter")
	Flowable<HttpResult<Object>> purchaseChapter(@Body Map<String, Object> map);

	@POST("/api/add/novel/library")
	Flowable<HttpResult<Object>> addLibrary(@QueryMap Map<String, Object> map);



}
